package cn.rumoss.jvm.deep.gc;

/**
 * -Xmx10M -XX:+PrintGCDetails
 * -XX:-UseAdaptiveSizePolicy 禁用自适应调整
 * -XX:SurvivorRatio=8
 * (2)-Xmx15M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8
 * @author xiaotang
 *
 */
public class ReferCountingGC {

	public Object instance = null;
	
	private static final int _1MB = 1024*1024;
	
	/**
	 * 作用是占点内存，方便在GC日志看是否被回收过
	 */
	private byte[] bigSize = new byte[2*_1MB];
	
	public static void main(String[] args) {
		
		ReferCountingGC objA = new ReferCountingGC();
		ReferCountingGC objB = new ReferCountingGC();
		objA.instance = objB;
		objB.instance = objA;
		
		objA = null;
		objB = null;
		
		System.gc();// GC objA和objB能被回收吗？

	}

}
